<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:jsf="http://xmlns.jcp.org/jsf/passthrough"
                template="/WEB-INF/templates/default.xhtml">

    <ui:define name="htmlhead">
        <title>Registrazione - TravelDream</title>
    </ui:define>

    <ui:define name="content">

        <section id="login-register">
            <div class="login-register-container">
                <h1>Registrati qui</h1>
                <div class="home-register solo-register">
                    <h:form>
                        <div>
                            <div class="clear-fix">
                                <div class="nome-left">
                                    <div>
                                        <h:inputText class="nome" id="nome" jsf:placeholder="Nome" value="#{registerBean.user.firstName}"/>
                                        <h:message for="nome" />
                                    </div>
                                </div>
                                <div class="cognome-right">
                                    <div>
                                        <h:inputText class="cognome" id="cognome" jsf:placeholder="Cognome"  value="#{registerBean.user.lastName}"/>
                                        <h:message for="cognome" />
                                    </div>
                                </div>
                            </div>
                            <div class="input-div">
                                <h:inputText class="email" id="email" jsf:placeholder="La tua email" binding="#{registerBean.email}" value="#{registerBean.user.email}"/>
                                <h:message for="email" />
                            </div>
                            <div class="input-div">
                                <h:inputSecret  class="password" id="password" jsf:placeholder="Nuova password" binding="#{passwordComponent}" value="#{registerBean.user.password}"/>
                                <h:message for="password" />
                            </div>
                            <div class="input-div">
                                <h:inputSecret class="password" id="confirmPassword" jsf:placeholder="Re-inserisci la password" required="#{not empty passwordComponent.value}">
                                    <f:validator validatorId="confirmPasswordValidator" />
                                    <f:attribute name="passwordComponent" value="#{passwordComponent}" />
                                </h:inputSecret>
                                <h:message for="confirmPassword" />
                            </div>

                            <div class="input-div submit">
                                <h:commandButton class="submit-button" value="Registrati" action="#{registerBean.register()}"/>
                            </div>
                        </div>
                    </h:form>
                </div>

            </div>
        </section>

    </ui:define>
</ui:composition>